package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: zhongyisheng
 * Date: 2024-07-02
 * Time: 19:17
 */
public class Test {
    public static void func(Animal animal)  {

    }
    public static Animal func2(){
        Dog dog = new Dog("旺财",10);
        return dog;
    }

    public static void main(String[] args) {
//        Dog dog = new Dog("旺财", 10);
//        Animal animal = dog; ↓ 向上转型
        Animal animal = new Dog("旺财",10);
        Dog dog = new Dog("旺财",10);
        func(dog);
        Animal animal1 = func2();
    }
}
